home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / BoxOut wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-21  |  1.6 KB  |  44 lines  |  [TEXT/KAHL]

  1. /*******************************************************************************
  2.  * Copywrite © 1992-1993 David S. Blumenthal                                   *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define        BOXES    50    /* increase this for a finer grained but more timely effect */
  15. #define CorrectTime 2
  16.  
  17. void BoxOutWipe(GrafPtr);
  18.  
  19. void BoxOutWipe(GrafPtr myGrafPtr)
  20. {
  21.     Rect    theRect;
  22.     int        cenx, ceny;
  23.     int        boxnum;
  24.     
  25.     /* change this as appropriate for the source and destination bounds */
  26.     cenx = MAIN_WINDOW_WIDTH / 2;
  27.     ceny = MAIN_WINDOW_HEIGHT / 2;
  28.     
  29.     for(boxnum = 0; boxnum <= BOXES; boxnum++)
  30.     {
  31.         StartTiming();
  32.         
  33.         /* this is not the most efficient method, but the overhead of the
  34.         multiplies and the redundant copying is hidden by the timing mechanism */
  35.         theRect.left = cenx - ((boxnum * cenx) / BOXES);
  36.         theRect.right = cenx + ((boxnum * cenx) / BOXES);
  37.         theRect.top = ceny - ((boxnum * ceny) / BOXES);
  38.         theRect.bottom = ceny + ((boxnum * ceny) / BOXES);
  39.         
  40.         CopyBits(&(myGrafPtr->portBits), &(gMainWindow->portBits),
  41.                 &theRect, &theRect, 0, 0L);
  42.         TimeCorrection(CorrectTime);
  43.     }
  44. }